﻿Public Partial Class NewTutorial
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAdd.Click

        Dim conn As OleDb.OleDbConnection = New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("TutorialConnectionString").ToString())
        conn.Open()
        Dim sqlString As String = "INSERT INTO TutorialList (Title,Link,Description) VALUES (@Title,@Link,@Description)"
        Dim dbCmd As OleDb.OleDbCommand = New OleDb.OleDbCommand(sqlString, conn)

        dbCmd.Parameters.AddWithValue("@Title", txttitle.Text)
        dbCmd.Parameters.AddWithValue("@Link", txtLink.Text)
        dbCmd.Parameters.AddWithValue("@Description", txtDescription.Text)

        dbCmd.ExecuteNonQuery()
        dbCmd.Dispose()
        conn.Close()
        conn.Dispose()
        Response.Redirect("default.aspx")
    End Sub
End Class